﻿

CREATE FUNCTION [dbo].[ContStartWith] (@SursaParam TipCont, @DestinatieParam TipCont)  
RETURNS bit AS  
BEGIN 
	DECLARE @inclus bit
	DECLARE @terminal bit
	DECLARE @Sursa TipCont
	DECLARE @Destinatie TipCont
	
	SET @Sursa = LTRIM(RTRIM(@SursaParam))
	SET @Destinatie = LTRIM(RTRIM(@destinatieParam))
	
	SET @terminal = 1
	SET @inclus = 0
	-- daca sunt egale e ok
	IF (@Destinatie = @Sursa)
		RETURN 1
	IF (substring(@Destinatie,1,len(@Sursa))=@Sursa) 
		RETURN 1
	RETURN 0
END